package cn.didi.feidi.androidorder.activity.personal;

import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageView;

import cn.didi.feidi.androidorder.R;
import cn.didi.feidi.androidorder.activity.SingleFragmentActivity;
import cn.didi.feidi.androidorder.assembly.CommomDialog;
import cn.didi.feidi.androidorder.assembly.FeidiActionBar;
import cn.didi.feidi.androidorder.fragment.personal.FindBackPayPswByAccountPswFragment;

public class FindBackPayPswByAccountPswActivity extends SingleFragmentActivity {

    @Override
    protected Fragment createFragment(Bundle bundle) {
        return FindBackPayPswByAccountPswFragment.newInstance(bundle);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initViews() {
        FeidiActionBar feidiActionBar = getFeidiActionBar();
        feidiActionBar.setMessageVisibility(View.GONE);
        feidiActionBar.setSettingVisibility(View.GONE);
        ImageView imageView = (ImageView) feidiActionBar.getFallbackView();
        imageView.setImageResource(R.drawable.fei_di_back_black);
        feidiActionBar.setNullBackgroundColor();
        feidiActionBar.setTitleText("找回支付密码");
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void addListener() {

    }

    @Override
    protected FeidiActionBar.FeidiActionBarCallBack addChaoActionBarCallBack() {
        return new FeidiActionBar.FeidiActionBarCallBack() {
            @Override
            public void onFallbackClickCallBack(View view) {
                showQuitActivity();
            }

            @Override
            public void onMessageClickCallBack(View view) {

            }

            @Override
            public void onSettingClickCallBack(View view) {

            }

            @Override
            public void onScanCodeCallBack(View view) {

            }

        };
    }

    @Override
    public void onBackPressed() {
        showQuitActivity();
    }

    private void showQuitActivity(){
        new CommomDialog(this, R.style.dialog, "确定要放弃找回密码？", new CommomDialog.OnCloseListener() {
            @Override
            public void onClick(Dialog dialog, boolean confirm) {
                if (confirm) {
                    finish();
                } else {
                    dialog.dismiss();
                }
            }
        }, false, true).setNegativeButton("继续修改","#999999").setPositiveButton("放弃","#347cf1").show();
    }
}
